#寻找两个列表中的相同元素
# ■ l1=[1,2,5]
# ■ [6,2,7]

l1=[1,2,5]
l2=[6,2,7]

r = []
for i in l1:
    for j in l2:
        if i==j :
            r.append(i)
print(r)

l1 = [1, 2, 5];
l2 = [6, 2, 7]
tup = [(i, j) for i in l1 for j in l2]
print(tup)
print([k for k in tup if k[0] == k[1]])

#http://www.liujiangblog.com/course/python/36
# python的各种推导式（列表推导式、字典推导式、集合推导式） https://www.cnblogs.com/tkqasn/p/5977653.html

#答案
'''
    l1=[1,2,5];l2=[6,2,7]
    tup=[(i,j) for i in l1 for j in l2]
    [k for k in tup if k[0]==k[1]]
'''